
package com.twu.biblioteca.library.items;
import com.twu.biblioteca.Constants.RatingConstants;
import com.twu.biblioteca.exception.InvalidMovieRatingException;
/**
 * Created by aruna on 26/4/14.
 */
public class Movie extends LibraryItem {
    private String Title,Director,Rating;
    int Year;
    public static int id=0;
    public Movie(String title,int year,String director,String rating)throws InvalidMovieRatingException
    {

        if(!RatingConstants.isValidRating(rating))
            throw new InvalidMovieRatingException();
        Title=title;
        Director=director;
        Rating=rating;
        Year=year;
        id++;
        String idString=""+id;
        setId(idString);
    }
    public String getTitle() {return Title;}
    public String getDirector(){ return Director;}
    public String getRating(){return Rating;}
    public int getYear(){return Year;}
    public String toString()
    {
        return getId()+"\t\t"+Title+"\t\t"+Year+"\t\t"+Director+"\t\t"+Rating+"\n";
    }
}
